import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const router = new VueRouter({
  mode: "history",
  routes: [
    {
      path: "/",
      redirect: "/home",
    },
    // 首页
    {
      path: "/home",
      name: "Home",
      component: () => import("../pages/home"),
      meta: {
        showPublicFooter: true,
        showPublicHeader: true,
        title: "首页",
      },
    },
    // 详情页
    {
      path: "/detail/:id",
      name: "Detail",
      component: () => import("../pages/detail"),
      meta: {
        showPublicFooter: false,
        showPublicHeader: true,
        title: "详情页",
      },
    },
    // 注册
    {
      path: "/register",
      name: "Register",
      component: () => import("../pages/register"),
      meta: {
        showPublicFooter: false,
        showPublicHeader: true,
        title: "注册",
      },
    },
    // 登录
    {
      path: "/login",
      name: "Login",
      component: () => import("../pages/login"),
      meta: {
        showPublicFooter: false,
        showPublicHeader: true,
        title: "登录",
      },
    },
    // 分类
    {
      path: "/fenlei",
      name: "Fenlei",
      component: () => import("../pages/fenlei"),
      meta: {
        showPublicFooter: true,
        showPublicHeader: true,
        title: "分类",
      },
    },
    // 购物车
    {
      path: "/cart",
      name: "Cart",
      component: () => import("../pages/cart"),
      meta: {
        showPublicFooter: true,
        showPublicHeader: true,
        title: "购物车",
      },
    },
    // 地址
    {
      path: "/address",
      name: "Address",
      component: () => import("../pages/address"),
      meta: {
        showPublicFooter: false,
        showPublicHeader: false,
        title: "地址",
      },
    },
    // 订单
    {
      path: "/order",
      name: "Order",
      component: () => import("../pages/order"),
      meta: {
        showPublicFooter: false,
        showPublicHeader: false,
        title: "我的订单",
      },
    },
    // 我的
    {
      path: "/mine",
      name: "Mine",
      component: () => import("../pages/mine"),
      meta: {
        showPublicFooter: true,
        showPublicHeader: true,
        title: "我的",
      },
    },
  ],
});

export default router;
